package com.yunhe.sms.control;

import com.yunhe.sms.dao.StudentDao;
import com.yunhe.sms.mode.Student;
import com.yunhe.sms.mode.Teacher;
import com.yunhe.sms.view.student.StudentAdd;
import com.yunhe.sms.view.student.StudentDle;
import com.yunhe.sms.view.student.StudentList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class StudentController {
    /**
     * 学员管理路由
     */
    public static void studentControllerRoute(){
        List<Student> studentList = StudentDao.getAllStudent();
        int i = StudentList.studentListUI(studentList);
        switch (i){
            case 1:{
                Student student = StudentAdd.studentAddUI();
               StudentDao.studentAdd(student);//添加学员
                studentControllerRoute();
                break;
            }
            case 2:{
                Student student = StudentAdd.studentAddUI();
                StudentDao.studentUpdate(student);//修改学员
                studentControllerRoute();
                break;
            }
            case 3:{
                Integer no = StudentDle.teacherDleUI();
                StudentDao.studentDle(no);//删除学员
                studentControllerRoute();
            }
            case 4:{
                HomeControllerFactory.homeRoute(UserController.strTypeToInt(LoginController.getCurrUser().getType()));//返回主页
                break;
            }
            case 5:studentControllerRoute();//刷新
        }
    }
}
